package Work02_List.son01;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();
        list.add(new Student("老八",33,"男"));
        list.add(new Student("老六",23,"男"));
        list.add(new Student("老王",77,"男"));
        int max=list.get(0).getAge();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getAge()>max){
                max=list.get(i).getAge();
            }
        }
        for (int i = 0; i < list.size(); i++) {
            if (max==list.get(i).getAge()){
                list.get(i).setName("小猪佩奇");
            }
        }
        System.out.println(list);
    }
}
